<template>
  <el-dialog
    :title="!dataForm.id ? '新增' : '修改'"
    :close-on-click-modal="false"
    @close="closeDialog()"
    :visible.sync="visible"
    width="60%">
    <play-bill  ref="playBillAddOrUpdate"  @refreshPlayBillData="refreshPlayBillData" @disPlayBillvisible="disPlayBillvisible"></play-bill>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" v-if="canSubmit">确定</el-button>
    </span>
  </el-dialog>
</template>
<style>
  .tip {
    padding: 8px 16px;
    background-color: #ecf8ff;
    border-radius: 4px;
    border-left: 5px solid #50bfff;
    margin: 20px 0;
  }
  .tb-edit .el-input {
    display: none
  }
  .tb-edit .current-row .el-input {
    display: block
  }
  .tb-edit .current-row .el-input+span {
    display: none
  }
</style>
<script>
  import PlayBill from './playBill-component'
  export default {
    data() {
      return {
        visible: false,
        canSubmit: false,
        databaseOptions: [],
        dataClassIdOptions:[],
        dataForm: {
          id:'',
          databaseId:'',
          ddataId: '',
          ddataClassId: '',
          dataName: '',
          timely : '',
          minFileNum: '',
          isFit: 0,
          jobCron:'',
          triggerStatus: 1,
          recs: [],
        },
        dataRule: {

        },
        table_columns: [
          {
            prop: "timeLevel",
            label: "时间",
            width: "150"
          },
          {
            prop: "minFileNum",
            label: "最小应收",
            width: "150"
          }
        ],
        new_date_json: {}, //数据结构
        multipleSelection: [], //复选框，数据
        is_edit: true, //是否可编辑
        is_delete: true, //是否可删除
        space_color: true, //隔行变色

      }
    },
    components: {
      PlayBill
    },
    methods: {
      init(id) {
        this.visible = true;
        this.canSubmit = true;
        this.$nextTick(() => {
          this.$refs.playBillAddOrUpdate.init(id)
        })
      },
      // 表单提交
      dataFormSubmit() {
        this.$refs.playBillAddOrUpdate.dataFormSubmit()
      },
      refreshPlayBillData () {
        this.$emit('refreshDataList')
      },
      //重置表单
      closeDialog() {
         this.$refs.playBillAddOrUpdate.closeDialog()
      },
      disPlayBillvisible () {
        this.visible = false
      }
      //保存
      /*handleSave(index, row) {
        row.edit = false;

        delete this.dataForm.recs[index].add;

        this.$message({
          message: "保存成功！",
          type: "success"
        });
      }*/


    }
  }
</script>

